Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: All webkit and Mobile Safari tests are failing with: browserContext.newPage: Protocol error #20481

Closed
NashJames opened this issue Jan 29, 2023 · 3 comments

Comments

@NashJames
Copy link

Context:

  • Playwright Version: 1.30.0
  • Operating System: WSL2
  • Node.js version: v16.18.1
  • Browser: All

Code Snippet

This is just one short example. It is affecting all tests.

import { test, expect } from '@playwright/test'

test.beforeEach(async ({ page }) => {
  await page.goto('http://localhost:1234')
})

test.describe('Home', () => {
  test('FullPage', async ({ page }) => {
    await expect(page).toHaveScreenshot({ fullPage: true })
  })
})

Describe the bug

The firefox, chromium, chrome, msedge and mobile chrome all work perfectly. But all safari based tests fail with the same message:

  8) [Mobile Safari] › hombut e.spec.ts:8:7 › Home › FullPage ==========================================

    browserContext.newPage: Protocol error (Page.overrideUserPreference): 'Page.overrideUserPreference' was not found [{"code":-32601,"message":"'Page.overrideUserPreference' was not found"}]

This is my first time setting up Playwright so I have no example of it working previously. I've changed very little since npm init playwright@latest so I doubt it's my configuration. I've installed all deps for the browsers as well.

I've tried for several hours to interpret the debug log using the docs, but I am no closer to figuring it out.

I searched for a while and the only similar mention I could find was #17699. I apologise if this is not a bug, but figured it was worth raising here if it's happened recently on an alternate OS.

@mxschmitt
Copy link
Member

I tried to reproduce, but it works for me without any issues. This issue is caused because a Playwright WebKit version is used with an incompatible Playwright version. (this should never happen).

Did you change something about browser downloads, move files in ms-playwright around or so? Can also be caused if you have multiple playwright installations in a project, or have playwright, playwright-core and @playwright/test there, only @playwright/test is enough.

@mxschmitt
Copy link
Member

Could you provide us your Ubuntu version? lsb_release -a

@NashJames
Copy link
Author

So I never messed with any of the downloads, and definitely only ever had @playwright/test. But I checked out my downloads after reading your comment and it's a bit of a mess:

image

I cleared out the folder and tried installing again, and now it's more what you'd expect:

![image](https://user-images.githubusercontent.com/37304960/215618973-7f9aa957-bf84-4e63-a12e-45a9aecd81c5.png

I'm on Ubuntu 18.04.5 LTS which I'm aware isn't supported, but I had no issues with it previously. Having cleared the folder and running the tests, I now unsurprisingly get this error:

    [pid=17973][out] ERROR: Ubuntu version is too old!
    [pid=17973][out] 
    [pid=17973][out] This version of Playwright does not support running
    [pid=17973][out] WebKit on Ubuntu 18.04. Please either:
    [pid=17973][out] - update your operating system to version Ubuntu 20.04 or higher
    [pid=17973][out] - use Playwright v1.28 or older

Guessing the duplicate webkit caused the issue. The only thing I can think created the mismatched browsers was using pnpm dlx playwright install --with-deps firefox chromium webkit chrome msedge when v1.30.0 was available and I had v1.28.0 of @playwright/test. I only then learned pnpm exec was reccommended here after receiving the mismatched versions warnings then.

The original issue has likely been sorted. Sorry I can't be more help on the cause. Thanks for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants